
/****** Object:  StoredProcedure [dbo].[web_update_user]    Script Date: 10/19/2013 09:22:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

--IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'web_update_user')
DROP PROCEDURE web_update_user
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[web_update_user] 
	@N60_KODAS_SM varchar(50),
	@n60_e_mail varchar(100),
	@n60_pav varchar(100),
	@n60_vardas varchar(100),
	@n60_pareigos varchar(50),
	@n60_pav2 varchar(100),
	@n60_kodas_ks varchar(50),
	@N08_kodas_ls_5 varchar(3),
	@N08_suma_wk_limit varchar(20)
AS
BEGIN

	SET NOCOUNT ON

	UPDATE n60_asm SET 
	n60_kodas_ks=@n60_kodas_ks,
	n60_pav2=@n60_pav2,
	n60_pareigos=@n60_pareigos,
	n60_vardas=@n60_vardas,
	n60_pav=@n60_pav,
	n60_e_mail=@n60_e_mail
	WHERE 
	N60_KODAS_SM=@N60_KODAS_SM
	
	If (@N08_kodas_ls_5='K01' OR @N08_kodas_ls_5='K02' ) and ISNUMERIC(@N08_suma_wk_limit)=1
		UPDATE N08_KLIJ SET
		N08_kodas_ls_5 = @N08_kodas_ls_5,
		N08_suma_wk_limit = CAST(@N08_suma_wk_limit as numeric(12,2))
		WHERE N08_KODAS_KS = @n60_kodas_ks
	else
		UPDATE N08_KLIJ SET
		N08_kodas_ls_5 = @N08_kodas_ls_5		
		WHERE N08_KODAS_KS = @n60_kodas_ks	
	
	

END

GO

